package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.AddressDao;
import com.victor.entity.Address;
import com.victor.service.AddressService;
@Service
public class AddressServiceImpl implements AddressService {
	@Autowired
	private AddressDao addressDao;

	@Override
	public boolean insert(Address address) {
		return addressDao.insertSelective(address);
	}

	@Override
	public boolean update(Address address) {
		return addressDao.updateByPrimaryKeySelective(address);
	}

	@Override
	public Address selById(Integer id) {
		return addressDao.selectByPrimaryKey(id);
	}

	@Override
	public PageInfo<Address> selAll(int page, int row, String uid) {
		PageHelper.startPage(page, row);
		List<Address> list = addressDao.selAll(uid);
		return new PageInfo<>(list, 5);
	}

	@Override
	public boolean updMoren(Integer id, String uid) {
		return addressDao.updMoren(id,uid);
	}

	@Override
	public boolean delete(Integer id) {
		return addressDao.deleteByPrimaryKey(id);
	}

	@Override
	public Address selMoren(String uid) {
		return addressDao.selMoren(uid);
	}

}
